<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>机器人管理后台</title>
    {include file='admin_src.html'}
    <link href="/static/admin/css/login.css" rel="stylesheet">
</head>
<body>
<div id="app" class="col-md-12 col-xs-12">
        <div class="col-md-3 col-md-offset-4 div-center" style="margin-left: 33.33333%">
            <div class="col-md-12 text-center color-white font-20">
                <b>微信机器人管理平台</b>
            </div>
            <div class="form-group color-white" >
                <label for="exampleInputPassword1">账号</label>
                <input type="text" class="form-control" v-model="username" id="exampleInputPassword1" placeholder="请输入账号">
            </div>
            <div class="form-group color-white">
                <label for="exampleInputPassword2">密码</label>
                <input type="password" class="form-control" v-model="password" id="exampleInputPassword2" placeholder="请输入密码">
            </div>
            <div class="form-group">
                <button type="button" class="btn btn-success" @click="login()">登录</button>
                <button type="button" class="btn btn-warning" @click="resetInput()">重置</button>
            </div>
        </div>
</div>
</body>
<script>
    var app = new Vue({
        el: '#app',
        data:function() {
            return {
                username: '',
                password:'',
            }
        },
        mounted:function(){
        },
        methods:{
            resetInput:function (){
                this.username = '';
                this.password = '';
            },
            login:function (){
                var that = this;
                if(!that.username){
                    coco.alert('账号不能为空');
                }
                if(!that.password){
                    coco.alert('密码不能为空');
                }
                apiRequest(adminApi.Login.login,{username:that.username,password:that.password},function (ret){
                    localStorage.setItem('admin_token',ret.token);
                    urlTo(PAGE_LIST.index)
                })

            }
        }
    })
</script>
</html>